﻿<phone:PhoneApplicationPage
    x:Class="Social_Celebrities.feedPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:converter="clr-namespace:Social_Celebrities"
    xmlns:player="clr-namespace:Microsoft.PlayerFramework;assembly=Microsoft.PlayerFramework"
    xmlns:LART="clr-namespace:LART.Controls;assembly=LART.Controls.ScrollableTextBlock"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"    
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d"
    shell:SystemTray.IsVisible="False">

    <phone:PhoneApplicationPage.Resources>
        <Style TargetType="ContentControl" x:Key="HintCustomStyle">
            <Setter Property="Foreground" Value="Gray"/>
        </Style>
        <converter:ImageFromRssText2 x:Key="ImageFromRssText2" />
        <converter:VideoFromRssText x:Key="VideoFromRssText" />
        <converter:PlainText x:Key="PlainText" />
        <converter:RssTextTrimmer1 x:Key="RssTextTrimmer1" />
        <converter:ImageFromRssText x:Key="ImageFromRssText"></converter:ImageFromRssText>
        <converter:ControlVisibility x:Key="ControlVisibility"></converter:ControlVisibility>
        <converter:ControlVisibilityVideo x:Key="ControlVisibilityVideo">
        </converter:ControlVisibilityVideo>
        <converter:DateToString x:Key="DateToString"></converter:DateToString>
    </phone:PhoneApplicationPage.Resources>
    <Grid x:Name="LayoutRoot" Background="{StaticResource bipivot}">
        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
            <RowDefinition Height="80"/>
        </Grid.RowDefinitions>

        <ListBox 
                Name="FaceListBox" 
                Grid.Row="0" 
                Visibility="Collapsed" 
                Margin="10,10,10,0"
                >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>                        
                        <ListBox 
                            Grid.Row="0" 
                            Width="480" 
                            Height="300" 
                            ScrollViewer.VerticalScrollBarVisibility="Disabled" 
                            ItemsSource="{Binding item.Summary.Text,Converter={StaticResource VideoFromRssText}}" 
                            Visibility="{Binding item.Summary.Text,Converter={StaticResource ControlVisibilityVideo}}">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel>
                                        <player:MediaPlayer 
                                         AutoPlay="True"
                                         Source="{Binding VideoURL1}" 
                                         Visibility="{Binding VideoVisibility}"
                                         Width="450" 
                                         Height="300">
                                        </player:MediaPlayer>
                                        <Image  
                               ImageOpened="Image_ImageOpened" 
                               ImageFailed="Image_ImageFailed" 
                               Source="{Binding ImageURL1}" 
                               Visibility="{Binding ImageVisibility}"
                               Tag="{Binding Title1}" 
                               Stretch="Uniform" 
                               Width="450" 
                               Height="300"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <!--<player:MediaPlayer AutoPlay="True"
                               Margin="0,10,0,0"  Source="{Binding item.Summary.Text,Converter={StaticResource VideoFromRssText}}" 
                               Visibility="{Binding item.Summary.Text,Converter={StaticResource ControlVisibilityVideo}}"  Width="150" 
                               Height="150"></player:MediaPlayer>-->
                        <TextBlock 
                                Margin="10,10,10,0" 
                                Grid.Row="1" 
                                Text="{Binding item.Summary.Text,Converter={StaticResource PlainText}}" 
                                HorizontalAlignment="Left" 
                                x:Name="tblkDescription" 
                                VerticalAlignment="Bottom"                                
                                TextWrapping="Wrap" 
                                Foreground="White" />
                        <TextBox x:Name="txtComment" 
                                   Grid.Row="2"
                                   Width="450" 
                                   Loaded="txtComment_Loaded"
                                    Margin="0,15,0,0" />
                        <ListBox Name="CommentsList" 
                                 Grid.Row="3" 
                                 Visibility="{Binding comments,TargetNullValue=Collapsed}" 
                                 Margin="10,0,10,10" 
                                 ItemsSource="{Binding comments}" 
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled"
                                 >                            
                            <ListBox.ItemTemplate>
                                <DataTemplate>                                                                                                       
                                    <StackPanel Margin="10,20,0,0">
                                        <TextBlock x:Name="TbName" 
                                                   Text="{Binding Name}"
                                                   FontWeight="SemiBold"
                                                       FontSize="23"/>
                                        <TextBlock x:Name="Tbcomment" 
                                                       Text="{Binding Comment}"                                                       
                                                       TextWrapping="Wrap"                                                       
                                                       FontSize="21.5"/>
                                        <TextBlock x:Name="TbDate" 
                                                       Text="{Binding Date,Converter={StaticResource DateToString}}"
                                                       FontWeight="Light"
                                                   FontSize="18"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <ListBox Name="TweetListBox" 
                 Grid.Row="0" 
                 Visibility="Collapsed" 
                 Margin="10,10,10,0"
                 >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <TextBlock 
                            Margin="10,10,10,0" 
                            Grid.Row="0" 
                            Text="{Binding item.Text}" 
                            HorizontalAlignment="Left" 
                            x:Name="feedSummary" 
                            VerticalAlignment="Bottom" 
                            
                            TextWrapping="Wrap" 
                            Foreground="White" 
                            />
                        <toolkit:PhoneTextBox 
                            Loaded="txtComment1_Loaded" 
                            LengthIndicatorVisible="False" 
                            Grid.Row="1" 
                            Foreground="Gray" 
                            BorderBrush="Gray" 
                            Width="450" 
                            Height="77" 
                            x:Name="txtComment1"
                            Margin="0,15,0,0"
                            HintStyle="{StaticResource HintCustomStyle}">
                        </toolkit:PhoneTextBox>
                        <ListBox Name="CommentsList1" 
                                 Grid.Row="2" 
                                 Margin="10,0,10,10" 
                                 Visibility="{Binding comments,TargetNullValue=Collapsed}" 
                                 ItemsSource="{Binding comments}" 
                                 ScrollViewer.VerticalScrollBarVisibility="Disabled">
                            <ListBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Margin="10,20,0,0">
                                        <TextBlock 
                                            x:Name="TbName" 
                                            Text="{Binding User.Name}"
                                            FontWeight="SemiBold"
                                            FontSize="23"/>
                                        <TextBlock 
                                            x:Name="Tbcomment" 
                                            Text="{Binding User.Description}"                                             
                                            TextWrapping="Wrap"                                            
                                            FontSize="21.5"/>
                                        <TextBlock 
                                            x:Name="TbDate" 
                                            Text="{Binding CreatedDate,Converter={StaticResource DateToString}}"
                                            FontWeight="Light"
                                            FontSize="18"/>
                                    </StackPanel>
                                </DataTemplate>
                            </ListBox.ItemTemplate>
                        </ListBox>
                        <!--<toolkit:PhoneTextBox 
                            Loaded="txtComment1_Loaded" 
                            LengthIndicatorVisible="False" 
                            Grid.Row="2" 
                            Foreground="Gray" 
                            BorderBrush="Gray" 
                            Width="400" 
                            Height="77" 
                            x:Name="txtComment1" 
                            HintStyle="{StaticResource HintCustomStyle}">
                        </toolkit:PhoneTextBox>-->
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>

        <ListBox 
            Name="BlogListBox" 
            Grid.Row="0" 
            Visibility="Collapsed" 
            Margin="10,10,10,0"
            >
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <LART:ScrollableTextBlock 
                            Name="feedSummary" 
                            Grid.Row="0" 
                            Margin="10,10,10,0" 
                            Text="{Binding item.Summary.Text, Converter={StaticResource RssTextTrimmer1}}" 
                            HorizontalAlignment="Left" 
                            VerticalAlignment="Bottom" 
                            Width="457" 
                            MinHeight="550" 
                            Foreground="White" />
                        <TextBox 
                            x:Name="txtComment2" 
                            Loaded="txtComment2_Loaded" 
                            Grid.Row="1" 
                            Width="450"
                            />
                    </Grid>
                </DataTemplate>
            </ListBox.ItemTemplate>
        </ListBox>
        <StackPanel x:Name="FeedAd" Grid.Row="1" Orientation="Vertical" Margin="0,0,0,0">          
        </StackPanel>
    </Grid>
    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True">
            <shell:ApplicationBarIconButton IconUri="/Images/post.png" Text="post" Click="ApplicationBarIconButton_Click_1"/>
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>